<%@ page
	import="merlin.beans.*,merlin.dao.*,merlin.managers.*,merlin.servlets.*,merlin.utils.*"
	contentType="text/html;charset=windows-1252"
%>

<%
	// remove any pre-existing session for this user.
	if(session.getAttribute("username") != null){
		session.invalidate();
	}
%>

<html>
  <head>
	<meta HTTP-EQUIV="Cache-Control"  CONTENT="no-cache" />
	<meta HTTP-EQUIV="Expires"        CONTENT="1 Jan 1980" />
	<meta HTTP-EQUIV="MaxAge"         CONTENT="0" />
	<meta HTTP-EQUIV="Pragma-Control" CONTENT="no-cache" />

    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>Industry Watch Login</title>
    <script>
		function isBlank(str){
			var len = str.length;
			if(len==0)return true;	// zero-length string
			for(i=0;i<len;i++){
				if(str.charAt(i) !=' ' && str.charAt(i) !='\n')return false; //some character is there
			}
			return true;
		}

		function verifyPassword(txtEmailAddress,txtPassword){
			if(isBlank(txtEmailAddress.value)){
				alert("Please enter a valid email address");
				txtEmailAddress.select();
				txtEmailAddress.focus();
				return false;
			}else{
				if(isBlank(txtPassword.value)){
					alert("Please enter a valid password");
					txtPassword.select();
					txtPassword.focus();
					return false;
				}else{
					document.getElementById("divLoggingIn").style.visibility = "visible";
					return true;
				}
			}
		}
    </script>

	<link href="css/master.css" rel="stylesheet" type="text/css">

  </head>


<body onload="document.loginForm.txtEmailAddress.focus()">

	<jsp:include page = "iwHeaderSmallest.jsp"/>

	<!-- DIV for displaying the "downloading report" message -->
	<div align="center" id="divLoggingIn" style="color:black;background-color:#FFFF00;visibility:hidden;position:absolute;left:400px;top:350px">
		<%= request.getHeader("user-agent").indexOf("MSIE") != -1 ? "<BR>" : "" %>
		<h3 style="padding: 2px;font-family: Verdana, Helvetica, Arial, sans-serif;font-size: 15px;vertical-align:center">&nbsp; Logging in .... &nbsp;</h3>
	</div>

	<table width="750" border="0" cellspacing="0" cellpadding="0" align="center">
		<tr>
			<td>
				<div style="height:.5cm;">
				</div>
				<div align='center' style="height:15px;">
				<%
					String err = (String)request.getAttribute("error.login");
					if(err != null){
						out.println("<span align='center' STYLE='FONT: 11px verdana,arial,sans-serif;color:red;font-weight:bold'>" + err + "</span>");
					}
					String msg = (String)request.getAttribute("message");
					if(msg != null){
						out.println("<span align='center' STYLE='FONT: 11px verdana,arial,sans-serif;color:GREEN;;font-weight:bold'>" + msg + "</span>");
					}
				%>
				</div>
				<p>
				</p>
				<div align='center' style="height:300">
				<form name="loginForm" method="post" action="industryWatch" onsubmit="return verifyPassword(txtEmailAddress,txtPassword)">

					<input type="hidden" name="mode" value="loginForIndustryWatch">

					<table width="60%" border="0"> <!-- style="background-color:rgb(146,207,100);font-family:tahoma;" -->
						<tr>
							<td width="40%" style='font:11px verdana,arial,sans-serif;'>
							 &nbsp;Enter your username
							</td>
							<td width="70%">
								<input type="text" name="txtEmailAddress" style="text-transform:lowercase;font:11px verdana,arial,sans-serif;width:200" value= '<%= request.getParameter("txtEmailAddress")!=null ? request.getParameter("txtEmailAddress") : "" %>' >
							</td>
						</tr>
						<tr>
							<td width="40%" style='font:11px verdana,arial,sans-serif;'>
							 &nbsp;Enter your password here
							</td>
							<td width="70%">
								<input type="password" name="txtPassword" style="text-transform:lowercase;font:11px verdana,arial,sans-serif;width:200" value= '' >
							</td>
						</tr>
						<tr>
							<td colspan='2'>
								<input type="button" name="btnRegister" value="Subscribe" onclick ="document.location='mr_reportSelection.jsp?view=IndustryWatch'" style="margin-right:20px;font: 11px verdana,arial, sans-serif ;width:90">
								<input type="button" name="btnFreeTrial" value="Request a Free Trial" onclick ="document.location='iwFreeTrialRegistration.jsp'" style="margin-right:20px;font: 11px verdana,arial, sans-serif ;width:150">
								<input type="SUBMIT" name="btnLogin" value="Log On" style="margin-right:20px;font: 11px verdana,arial, sans-serif ;width:90">
							</td>
						</tr>
					</table>
				</form>
				</div>
			</td>
		</tr>
	</table>

	<div style="height:1.0cm;">
	</div>
	<jsp:include page="mr_footer.jsp"/>
  </body>
</html>